```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数据库基础教程 - 专业MySQL学习指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        :root {
            --primary: #4361ee;
            --secondary: #3f37c9;
            --accent: #4895ef;
            --dark: #1b1b1e;
            --light: #f8f9fa;
            --success: #4cc9f0;
        }
        body {
            font-family: 'Noto Sans SC', 'Noto Serif SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
        }
        .hero-gradient {
            background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
        }
        .card {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        }
        .code-block {
            font-family: 'Courier New', Courier, monospace;
            background-color: #2d2d2d;
            color: #f8f8f2;
            border-radius: 6px;
            padding: 1rem;
            overflow-x: auto;
        }
        .sql-keyword {
            color: #f92672;
        }
        .sql-string {
            color: #e6db74;
        }
        .sql-number {
            color: #ae81ff;
        }
        .sql-comment {
            color: #75715e;
        }
        .section-divider {
            border: 0;
            height: 1px;
            background-image: linear-gradient(to right, rgba(0, 0, 0, 0), var(--accent), rgba(0, 0, 0, 0));
        }
        .highlight {
            position: relative;
        }
        .highlight:after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 30%;
            background-color: rgba(67, 97, 238, 0.2);
            z-index: -1;
            transition: height 0.3s ease;
        }
        .highlight:hover:after {
            height: 100%;
        }
        .drop-cap:first-letter {
            float: left;
            font-size: 4.5rem;
            line-height: 0.9;
            margin-right: 0.8rem;
            margin-top: 0.3rem;
            font-weight: bold;
            color: var(--primary);
        }
    </style>
</head>
<body class="antialiased">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-6xl text-center">
            <div class="flex justify-center mb-6">
                <div class="bg-white bg-opacity-20 p-3 rounded-full inline-flex items-center justify-center">
                    <i class="fas fa-database text-3xl"></i>
                </div>
            </div>
            <h1 class="text-4xl md:text-5xl font-bold mb-6 leading-tight">掌握MySQL数据库基础</h1>
            <p class="text-xl md:text-2xl font-light max-w-3xl mx-auto mb-10 opacity-90">
                从零开始学习关系型数据库的核心概念、SQL语法与最佳实践
            </p>
            <div class="flex flex-wrap justify-center gap-4">
                <a href="#concepts" class="px-8 py-3 bg-white text-blue-800 font-semibold rounded-full hover:bg-opacity-90 transition-all">
                    <i class="fas fa-brain mr-2"></i>核心概念
                </a>
                <a href="#tutorial" class="px-8 py-3 border-2 border-white text-white font-semibold rounded-full hover:bg-white hover:bg-opacity-10 transition-all">
                    <i class="fas fa-code mr-2"></i>实战教程
                </a>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-6xl px-4 md:px-6 py-12">
        <!-- Database Concepts Section -->
        <section id="concepts" class="mb-20">
            <div class="flex items-center mb-10">
                <div class="w-12 h-12 rounded-full bg-blue-100 flex items-center justify-center mr-4">
                    <i class="fas fa-database text-blue-600 text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">1. 数据库基础概念</h2>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden card mb-10">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <span class="flex items-center justify-center w-10 h-10 rounded-full bg-blue-100 text-blue-700 font-bold mr-4">1</span>
                        <h3 class="text-2xl font-semibold text-gray-800">什么是数据库？</h3>
                    </div>
                    <p class="text-gray-700 mb-6 drop-cap">
                        数据库（database）就是一个存储数据的仓库。为了方便数据的存储和管理，它将数据按照特定的规律存储在磁盘上。通过数据库管理系统，可以有效地组织和管理存储在数据库中的数据DB。
                    </p>
                    
                    <div class="grid md:grid-cols-2 gap-8 mt-10">
                        <div>
                            <h4 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                                <i class="fas fa-layer-group text-blue-500 mr-2"></i> 数据库层级结构
                            </h4>
                            <div class="mermaid max-w-full overflow-auto">
                                graph TD
                                    A[数据库服务器] --> B[数据库]
                                    B --> C[数据表]
                                    C --> D[数据字段]
                                    C --> E[数据行]
                            </div>
                        </div>
                        <div>
                            <h4 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                                <i class="fas fa-info-circle text-blue-500 mr-2"></i> 五个核心概念
                            </h4>
                            <ul class="space-y-4">
                                <li class="flex items-start">
                                    <span class="bg-blue-100 text-blue-700 rounded-full w-6 h-6 flex items-center justify-center mr-3 flex-shrink-0">1</span>
                                    <span><strong class="text-gray-800">数据库服务器</strong> - 运行数据库服务的电脑，小型项目通常为一台，中大型项目多台服务器协同工作</span>
                                </li>
                                <li class="flex items-start">
                                    <span class="bg-blue-100 text-blue-700 rounded-full w-6 h-6 flex items-center justify-center mr-3 flex-shrink-0">2</span>
                                    <span><strong class="text-gray-800">数据库</strong> - 服务器中可以包含多个数据库，按业务分类如学员管理系统、电商数据库等</span>
                                </li>
                                <li class="flex items-start">
                                    <span class="bg-blue-100 text-blue-700 rounded-full w-6 h-6 flex items-center justify-center mr-3 flex-shrink-0">3</span>
                                    <span><strong class="text-gray-800">数据表</strong> - 数据库中按业务划分的数据表，如学员表(学号、用户名、密码)、老师表等</span>
                                </li>
                                <li class="flex items-start">
                                    <span class="bg-blue-100 text-blue-700 rounded-full w-6 h-6 flex items-center justify-center mr-3 flex-shrink-0">4</span>
                                    <span><strong class="text-gray-800">数据字段</strong> - 表格中的列，如用户编号(id)、用户名(username)、性别(sex)等</span>
                                </li>
                                <li class="flex items-start">
                                    <span class="bg-blue-100 text-blue-700 rounded-full w-6 h-6 flex items-center justify-center mr-3 flex-shrink-0">5</span>
                                    <span><strong class="text-gray-800">数据行</strong> - 表中的实际数据，每行遵循字段定义的规范</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white rounded-xl shadow-md overflow-hidden card">
                    <div class="p-8">
                        <div class="flex items-center mb-6">
                            <span class="flex items-center justify-center w-10 h-10 rounded-full bg-green-100 text-green-700 font-bold mr-4">2</span>
                            <h3 class="text-2xl font-semibold text-gray-800">MySQL简介</h3>
                        </div>
                        <p class="text-gray-700 mb-4">
                            MySQL是一款完全免费的关系型数据库管理系统，具有跨平台优势，可以从<a href="http://dev.mysql.com/downloads/mysql/" class="text-blue-600 hover:underline">官方网站</a>直接下载使用。
                        </p>
                        <p class="text-gray-700 mb-4">
                            MySQL是一个真正的多用户、多线程SQL数据库服务器，采用客户机/服务器结构实现，由一个服务器守护程序和多种客户程序组成。
                        </p>
                        <div class="bg-blue-50 border-l-4 border-blue-500 p-4 mt-6">
                            <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                <i class="fas fa-star text-yellow-500 mr-2"></i> MySQL 5.6关键特性
                            </h4>
                            <ul class="list-disc list-inside space-y-1 text-gray-700">
                                <li>InnoDB作为默认存储引擎</li>
                                <li>优化性能和可扩展性</li>
                                <li>提高实用性和易管理性</li>
                                <li>增强可用性</li>
                            </ul>
                        </div>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden card">
                    <div class="p-8">
                        <div class="flex items-center mb-6">
                            <span class="flex items-center justify-center w-10 h-10 rounded-full bg-purple-100 text-purple-700 font-bold mr-4">3</span>
                            <h3 class="text-2xl font-semibold text-gray-800">SQL语言</h3>
                        </div>
                        <p class="text-gray-700 mb-4">
                            结构化查询语言(SQL)是用于存取数据以及查询、更新和管理关系数据库系统的特殊目的编程语言，也是数据库脚本文件的扩展名。
                        </p>
                        <p class="text-gray-700 mb-6">
                            SQL最初由IBM在1970年代为其关系型数据库System R开发，现已成为国际标准(ISO)。
                        </p>
                        
                        <div class="space-y-4">
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                    <i class="fas fa-code text-purple-500 mr-2"></i> SQL分类
                                </h4>
                                <div class="bg-gray-50 p-4 rounded-lg">
                                    <div class="flex items-start mb-3">
                                        <span class="bg-purple-100 text-purple-700 rounded-full w-6 h-6 flex items-center justify-center mr-3 mt-1 flex-shrink-0">1</span>
                                        <div>
                                            <strong class="text-gray-800">数据定义语言(DDL)</strong>
                                            <p class="text-gray-700">定义数据对象：create、drop、alter等</p>
                                        </div>
                                    </div>
                                    <div class="flex items-start mb-3">
                                        <span class="bg-purple-100 text-purple-700 rounded-full w-6 h-6 flex items-center justify-center mr-3 mt-1 flex-shrink-0">2</span>
                                        <div>
                                            <strong class="text-gray-800">数据操作语言(DML)</strong>
                                            <p class="text-gray-700">操作数据记录：insert、delete、update、select</p>
                                        </div>
                                    </div>
                                    <div class="flex items-start">
                                        <span class="bg-purple-100 text-purple-700 rounded-full w-6 h-6 flex items-center justify-center mr-3 mt-1 flex-shrink-0">3</span>
                                        <div>
                                            <strong class="text-gray-800">数据控制语言(DCL)</strong>
                                            <p class="text-gray-700">控制访问权限：grant、revoke等</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        
        <hr class="section-divider my-12">
        
        <!-- Database Tutorial Section -->
        <section id="tutorial" class="mb-20">
            <div class="flex items-center mb-10">
                <div class="w-12 h-12 rounded-full bg-indigo-100 flex items-center justify-center mr-4">
                    <i class="fas fa-laptop-code text-indigo-600 text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">2. 数据库操作实战</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-10">
                <div class="bg-white rounded-xl shadow-md overflow-hidden card">
                    <div class="p-8">
                        <div class="flex items-center mb-6">
                            <span class="flex items-center justify-center w-10 h-10 rounded-full bg-blue-100 text-blue-700 font-bold mr-4">1</span>
                            <h3 class="text-2xl font-semibold text-gray-800">数据库管理</h3>
                        </div>
                        
                        <div class="space-y-6">
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                    <i class="fas fa-plus-circle text-green-500 mr-2"></i> 创建数据库
                                </h4>
                                <div class="code-block">
                                    <span class="sql-keyword">CREATE DATABASE</span> 数据库名称;
                                </div>
                            </div>
                            
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                    <i class="fas fa-trash-alt text-red-500 mr-2"></i> 删除数据库
                                </h4>
                                <div class="code-block">
                                    <span class="sql-keyword">DROP DATABASE</span> 数据库名称;
                                </div>
                            </div>
                            
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                    <i class="fas fa-list text-blue-500 mr-2"></i> 查看所有数据库
                                </h4>
                                <div class="code-block">
                                    <span class="sql-keyword">SHOW DATABASES</span>;
                                </div>
                            </div>
                            
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                    <i class="fas fa-plug text-purple-500 mr-2"></i> 连接数据库
                                </h4>
                                <div class="code-block">
                                    <span class="sql-keyword">USE</span> 数据库名称;
                                </div>
                            </div>
                            
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                    <i class="fas fa-info-circle text-yellow-500 mr-2"></i> 查看数据库信息
                                </h4>
                                <div class="code-block">
                                    <span class="sql-keyword">STATUS</span>;
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden card">
                    <div class="p-8">
                        <div class="flex items-center mb-6">
                            <span class="flex items-center justify-center w-10 h-10 rounded-full bg-green-100 text-green-700 font-bold mr-4">2</span>
                            <h3 class="text-2xl font-semibold text-gray-800">数据表管理</h3>
                        </div>
                        
                        <div class="space-y-6">
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                    <i class="fas fa-table text-blue-500 mr-2"></i> 创建数据表
                                </h4>
                                <div class="code-block">
                                    <span class="sql-keyword">CREATE TABLE</span> 表名称(<br/>
                                    &nbsp;&nbsp;字段名称 字段类型 [<span class="sql-keyword">DEFAULT</span> 默认值],<br/>
                                    &nbsp;&nbsp;字段名称 字段类型 [<span class="sql-keyword">DEFAULT</span> 默认值],<br/>
                                    &nbsp;&nbsp;其他字段...<br/>
                                    );
                                </div>
                            </div>
                            
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                    <i class="fas fa-search text-green-500 mr-2"></i> 查看表结构
                                </h4>
                                <div class="code-block">
                                    <span class="sql-keyword">DESC</span> 表名称;
                                </div>
                            </div>
                            
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                    <i class="fas fa-edit text-purple-500 mr-2"></i> 修改表名
                                </h4>
                                <div class="code-block">
                                    <span class="sql-keyword">ALTER TABLE</span> 旧表名 <span class="sql-keyword">RENAME</span> 新表名;
                                </div>
                            </div>
                            
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                    <i class="fas fa-trash text-red-500 mr-2"></i> 删除表
                                </h4>
                                <div class="code-block">
                                    <span class="sql-keyword">DROP TABLE</span> 表名称;
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden card mb-10">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <span class="flex items-center justify-center w-10 h-10 rounded-full bg-purple-100 text-purple-700 font-bold mr-4">3</span>
                        <h3 class="text-2xl font-semibold text-gray-800">数据操作(CRUD)</h3>
                    </div>
                    
                    <div class="grid md:grid-cols-2 gap-8">
                        <div>
                            <h4 class="font-semibold text-gray-800 mb-4 flex items-center">
                                <i class="fas fa-plus-circle text-green-500 mr-2"></i> 添加数据
                            </h4>
                            <div class="code-block mb-6">
                                <span class="sql-keyword">INSERT INTO</span> 表名称([列1,列2...]) <span class="sql-keyword">VALUES</span>(值1,值2);
                            </div>
                            
                            <h4 class="font-semibold text-gray-800 mb-4 flex items-center">
                                <i class="fas fa-sync-alt text-blue-500 mr-2"></i> 更新数据
                            </h4>
                            <div class="code-block">
                                <span class="sql-keyword">UPDATE</span> 表名称 <span class="sql-keyword">SET</span> 字段=值[,字段=值] <span class="sql-keyword">WHERE</span> 条件;
                            </div>
                        </div>
                        
                        <div>
                            <h4 class="font-semibold text-gray-800 mb-4 flex items-center">
                                <i class="fas fa-trash-alt text-red-500 mr-2"></i> 删除数据
                            </h4>
                            <div class="code-block mb-6">
                                <span class="sql-keyword">DELETE FROM</span> 表名称 [<span class="sql-keyword">WHERE</span> 删除条件];
                            </div>
                            
                            <h4 class="font-semibold text-gray-800 mb-4 flex items-center">
                                <i class="fas fa-search text-yellow-500 mr-2"></i> 查询数据
                            </h4>
                            <div class="code-block">
                                <span class="sql-keyword">SELECT</span> * <span class="sql-keyword">FROM</span> 表名称;
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white rounded-xl shadow-md overflow-hidden card">
                    <div class="p-8">
                        <div class="flex items-center mb-6">
                            <span class="flex items-center justify-center w-10 h-10 rounded-full bg-indigo-100 text-indigo-700 font-bold mr-4">4</span>
                            <h3 class="text-2xl font-semibold text-gray-800">MySQL数据类型</h3>
                        </div>
                        
                        <div class="overflow-x-auto">
                            <table class="min-w-full divide-y divide-gray-200">
                                <thead class="bg-gray-50">
                                    <tr>
                                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">序号</th>
                                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">类型</th>
                                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">描述</th>
                                    </tr>
                                </thead>
                                <tbody class="bg-white divide-y divide-gray-200">
                                    <tr>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">1</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">CHAR(长度)</td>
                                        <td class="px-6 py-4 text-sm text-gray-500">表示字符串类型, 数字</td>
                                    </tr>
                                    <tr class="bg-blue-50">
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">2</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">VARCHAR(长度)</td>
                                        <td class="px-6 py-4 text-sm text-gray-500">可以存放数字，字母</td>
                                    </tr>
                                    <tr class="bg-blue-50">
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">3</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">INT(长度)</td>
                                        <td class="px-6 py-4 text-sm text-gray-500">表示INT类型</td>
                                    </tr>
                                    <tr class="bg-blue-50">
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">4</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">DATE</td>
                                        <td class="px-6 py-4 text-sm text-gray-500">表示日期类型(不包含时分秒)</td>
                                    </tr>
                                    <tr class="bg-blue-50">
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">5</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">datetime</td>
                                        <td class="px-6 py-4 text-sm text-gray-500">表示时间类型(包含时分秒)</td>
                                    </tr>
                                    <tr>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">6</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">TEXT</td>
                                        <td class="px-6 py-4 text-sm text-gray-500">放大文本字符串</td>
                                    </tr>
                                    <tr class="bg-blue-50">
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">7</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">FLOAT</td>
                                        <td class="px-6 py-4 text-sm text-gray-500">浮点类型</td>
                                    </tr>
                                    <tr>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">8</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">BLOB</td>
                                        <td class="px-6 py-4 text-sm text-gray-500">用于存放二进制文件,例如图片,电影,音乐</td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden card">
                    <div class="p-8">
                        <div class="flex items-center mb-6">
                            <span class="flex items-center justify-center w-10 h-10 rounded-full bg-teal-100 text-teal-700 font-bold mr-4">5</span>
                            <h3 class="text-2xl font-semibold text-gray-800">数据库约束</h3>
                        </div>
                        
                        <div class="space-y-6">
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                    <i class="fas fa-ban text-red-500 mr-2"></i> 非空约束(NK)
                                </h4>
                                <div class="code-block">
                                    <span class="sql-keyword">CREATE TABLE</span> my_user(<br/>
                                    &nbsp;&nbsp;id <span class="sql-keyword">int</span>,<br/>
                                    &nbsp;&nbsp;name <span class="sql-keyword">varchar</span>(200) <span class="sql-keyword">NOT NULL</span> <span class="sql-comment">-- 此字段不允许为NULL</span><br/>
                                    );
                                </div>
                            </div>
                            
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                    <i class="fas fa-unique text-purple-500 mr-2"></i> 唯一约束(UK)
                                </h4>
                                <div class="code-block">
                                    <span class="sql-keyword">CREATE TABLE</span> my_user(<br/>
                                    &nbsp;&nbsp;id <span class="sql-keyword">int</span>,<br/>
                                    &nbsp;&nbsp;email <span class="sql-keyword">varchar</span>(50) <span class="sql-keyword">UNIQUE</span> <span class="sql-comment">-- 此列不允许重复</span><br/>
                                    );
                                </div>
                            </div>
                            
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                    <i class="fas fa-key text-yellow-500 mr-2"></i> 主键约束(PK)
                                </h4>
                                <div class="code-block">
                                    <span class="sql-keyword">CREATE TABLE</span> my_user(<br/>
                                    &nbsp;&nbsp;id <span class="sql-keyword">int PRIMARY KEY AUTO_INCREMENT</span>, <span class="sql-comment">-- 唯一标识，自动递增</span><br/>
                                    );
                                </div>
                            </div>
                            
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                    <i class="fas fa-link text-blue-500 mr-2"></i> 主-外键约束(FK)
                                </h4>
                                <div class="code-block">
                                    <span class="sql-keyword">CREATE TABLE</span> t_customer (<br/>
                                    &nbsp;&nbsp;cid <span class="sql-keyword">int NOT NULL PRIMARY KEY</span>,<br/>
                                    );<br/><br/>
                                    <span class="sql-keyword">CREATE TABLE</span> t_order(<br/>
                                    &nbsp;&nbsp;oid <span class="sql-keyword">int</span>,<br/>
                                    &nbsp;&nbsp;<span class="sql-keyword">CONSTRAINT</span> PK_oid <span class="sql-keyword">PRIMARY KEY</span> (oid),<br/>
                                    &nbsp;&nbsp;<span class="sql-keyword">CONSTRAINT</span> FK_cid <span class="sql-keyword">FOREIGN KEY</span> (customer_id) <span class="sql-keyword">REFERENCES</span> t_customer (cid)<br/>
                                    );
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        
        <hr class="section-divider my-12">
        
        <!-- Backup & Restore Section -->
        <section class="mb-10">
            <div class="flex items-center mb-10">
                <div class="w-12 h-12 rounded-full bg-amber-100 flex items-center justify-center mr-4">
                    <i class="fas fa-shield-alt text-amber-600 text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">3. 数据库备份与恢复</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white rounded-xl shadow-md overflow-hidden card">
                    <div class="p-8">
                        <div class="flex items-center mb-6">
                            <span class="flex items-center justify-center w-10 h-10 rounded-full bg-green-100 text-green-700 font-bold mr-4">1</span>
                            <h3 class="text-2xl font-semibold text-gray-800">数据库备份</h3>
                        </div>
                        
                        <div>
                            <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                <i class="fas fa-database text-blue-500 mr-2"></i> 导出整个数据库
                            </h4>
                            <div class="code-block mb-6">
                                mysqldump -u 用户名 -p 数据库名 > 导出的文件名
                            </div>
                            
                            <h4 class="font-semibold text-gray-800 mb-2 flex items-center">
                                <i class="fas fa-table text-green-500 mr-2"></i> 导出一张表
                            </h4>
                            <div class="code-block">
                                mysqldump -u 用户名 -p 数据库名 表名称 > 导出的文件名
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden card">
                    <div class="p-8">
                        <div class="flex items-center mb-6">
                            <span class="flex items-center justify-center w-10 h-10 rounded-full bg-blue-100 text-blue-700 font-bold mr-4">2</span>
                            <h3 class="text-2xl font-semibold text-gray-800">数据库恢复</h3>
                        </div>
                        
                        <div>
                            <p class="text-gray-700 mb-4">
                                数据的恢复需要先登录MySQL，创建新数据库并进入该数据库后执行：
                            </p>
                            <div class="code-block">
                                <span class="sql-keyword">SOURCE</span> 脚本目录(绝对路径)
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // 平滑滚动
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>
```